11/6/01
added on stringToList(theString, theDelimiters)

18/5/01
modified createNewSubjectID() not to accept empty subject IDs
fixed stupid bugs in writeToCompanionFile(theData, fileSuffix)

15/5
added
distinct(theList)
union(listA, listB)
intersection(listA, listB)

29/4
general cleanup

23/4/01
added 2 handlers to aid setting lists of noticed keys
setNoticed of keyName given mapping:theMapping --setNoticed of "K" given mapping:"name you want"
noticeKeyboard(keyList)

improved error handling of readSpreadsheet()
added readspreadsheet1D() --reads lines as items

23/April/01
Modified sample(itemCount, TheList, replacing) to be more efficient following comments from John Vokey <vokey@uleth.ca>

Improved speed of sort routine by 10 times
(Howard Peters" <hpeters@rockriver.net> )

18/April/2001
changed createNewSubjectID to allow adding on to an existing file

note: this could be changed to allow overwrite, append, or fail.

added property to store key state
property pKeyState : "" --contents of every key for restoring to a previous state

Added key state saving & 
on saveKeyStates()

tell application "PsyScript"

set pKeyState to contents of every key

end tell
end saveKeyStates

on restoreKeyStates()

tell application "PsyScript"

repeat with aKey in pKeyState

set zz to name of aKey

set noticed of key zz to noticed of aKey

set mapping of key zz to mapping of aKey

end repeat

end tell
end restoreKeyStates

on centreOfRect(tRect) --format = l,t,r,b

set x to (item 3 of tRect) - (item 1 of tRect)

set y to (item 4 of tRect) - (item 2 of tRect)

return x, y
end centreOfRect